<template>
  <div>
    <!-- 导航栏 -->
    <van-nav-bar
      title="商户设置"
      left-arrow
      :border="false"
      fixed
      @click-left="$utils.back($route.path);"
    />
    <div class="has-top" />

    <van-cell-group>
      <van-cell title="修改商户资料" is-link to="/bussinessSetting/editInfo" />
      <van-cell title="实名认证" is-link :value="RealNameVerify?'已认证':'未认证'" @click="toVerified" />
      <van-cell title="电子协议" is-link to="/bussinessSetting/electronicAgreement" />
      <van-cell title="收款账户管理" is-link to="/bussinessSetting/receiptAcountManage" />
      <van-cell title="功能设置" is-link to="/bussinessSetting/function" />
      <van-cell title="收款二维码" is-link to="/bussinessSetting/receiptQr" />
      <!-- <van-cell title="密码安全" is-link /> -->
    </van-cell-group>
  </div>
</template>

<script>
import { getUserInfo } from 'api/store'

export default {
  data() {
    return {
      RealNameVerify: false
    }
  },
  created() {
    if (this.$store.getters.RealNameVerify != undefined) {
      this.RealNameVerify = this.$store.getters.RealNameVerify
    } else {
      this.getUserInfo()
    }
  },
  methods: {
    // 获取商家个人信息
    getUserInfo() {
      getUserInfo().then(res => {
        // console.log(res);
        if (res) {
          this.RealNameVerify = res.Data.RealNameVerify
          this.$store.dispatch('user/setRealNameVerify', this.RealNameVerify)
        }
      })
    },
    // 判断是否实名
    toVerified() {
      if (this.RealNameVerify) {
        this.$toast({
          icon: 'smile-o',
          message: '您已完成实名认证了哦!'
        })
      } else {
        this.$router.push('/bussinessSetting/verified')
      }
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
